



import bpy
import idprop

import 全局控制.Node.插座.bl_插座基类 as 插座基类
from 节点.Core import bl_UI配色


import engine.initLIB.load_dll as engineLib
import ctypes



class C_NodeSocket_粒子组(插座基类.C_Socket_基类):
	bl_label = '粒子集合'
	#m_Value = idprop.types.IDPropertyArray.mro()
	m_位置 = bpy.props.FloatVectorProperty(default=(0.0, 0.0, 0.0), update=f_socketVec3Update)
	m_速度 = bpy.props.FloatVectorProperty(default=(0.0, 0.0, 0.0), update=f_socketVec3Update)
	m_大小 = bpy.props.FloatProperty(default=0.0, update=f_socketVec3Update)
	def __init__(self):
		super(C_NodeSocket_粒子组, self).__init__()
		
	def draw(self, context, layout, node, text):
		if self.is_output == False and self.is_linked == False :
			layout.prop(self, 'm_位置', icon='EMPTY_ARROWS')
			layout.prop(self, 'm_速度', icon='ORIENTATION_GLOBAL')
			layout.prop(self, 'm_大小', icon='META_DATA')
		else:
			layout.label(text=text+':vec3+vec3+f', icon='MOD_PARTICLES')
			
	def draw_color(self, context, node):
		return bl_UI配色.g_矢量插座颜色

	def f_getData(self):
		if self.is_linked:
			print('C_Socket_物体=', self.node.id_data.name, self.node.name, self.name)
			name = engineLib.flexCAPI.f_取插座数据(ctypes.c_wchar_p(self.node.id_data.name), ctypes.c_wchar_p(self.node.name), ctypes.c_wchar_p(self.identifier))
			#print('text ==== ', text)
			#name = str(ctypes.string_at(text, -1), encoding="gbk")
			print('text ==name== ', name)
			return bpy.data.objects[name]
		else:
			return None
		
	def f_setData(self):
		return None


classes = (
	C_NodeSocket_粒子组,
	
)

def register():
	for c in classes:
		bpy.utils.register_class(c)
	pass	

def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)
	pass
	


